//
//  NGbbsViewController.swift
//  NingguoForum
//
//  Created by zhengsw on 2020/11/12.
//  Copyright © 2020 zhengsw. All rights reserved.
//

import UIKit

class NGbbsViewController: UIViewController, NGbbsTableViewDelegate,NGbbsNavigationBarViewDelegate {
    lazy var navigationBarView: NGbbsNavigationBarView = {
        navigationBarView = NGbbsNavigationBarView(frame: CGRect(x: 0, y: 0, width: KSCREEN_WIDTH, height: KDevice_NaviBar_Height))
        navigationBarView.delegate = self

        return navigationBarView
    }()

    override func viewDidLoad() {
        super.viewDidLoad()
        
        

        self.view.backgroundColor = RGB_COLOR(r: 248, g: 248, b: 248)
        
        let bbsTableView = NGbbsTableView(frame: CGRect(x: 0, y: KDevice_NaviBar_Height, width: KSCREEN_WIDTH, height: KSCREEN_HEIGHT - KDevice_TabBar_Height - KDevice_NaviBar_Height))
        bbsTableView.delegate = self  // 设置代理
        view.addSubview(bbsTableView)
        
        view.addSubview(navigationBarView)
        
        getDatas()
        
        
    }
    
    func goUserInfoAction() {
        
    }
    
    func searchAction() {

        let searchVC = NGForumSearchController()
        self.navigationController?.pushViewController(searchVC, animated: true)
    }
    
    func getDatas () {
     

    }
    // MARK: - NGbbsTableViewDelegate
    func didSelectCollectionViewItem(section: Int, item: Int, itemModel: Any) {
        print("=== 外层 VC 接收到点击事件 ===")
        print("Section: \(section)")
        print("Item: \(item)")
        print("ItemModel: \(itemModel)")
        
        // 在这里处理具体的业务逻辑
        // 例如：跳转到详情页面、显示弹窗等
        
        // 示例：跳转到详情页面
        let detailVC = NGForumViewController(model: (itemModel as! ResponseCircleClassItemModel))
         navigationController?.pushViewController(detailVC, animated: true)
    }
}
